<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>NumCpp: Slice.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="NumCppLogoDoxygen.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">NumCpp
   &#160;<span id="projectnumber">2.4.0</span>
   </div>
   <div id="projectbrief">A Templatized Header Only C++ Implementation of the Python NumPy Library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('_slice_8hpp_source.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">Slice.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_slice_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160; </div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="preprocessor">#pragma once</span></div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160; </div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_error_8hpp.html">NumCpp/Core/Internal/Error.hpp</a>&quot;</span></div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_types_8hpp.html">NumCpp/Core/Types.hpp</a>&quot;</span></div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="num2str_8hpp.html">NumCpp/Utils/num2str.hpp</a>&quot;</span></div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160; </div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<span class="preprocessor">#include &lt;algorithm&gt;</span></div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;<span class="preprocessor">#include &lt;iostream&gt;</span></div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;<span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160; </div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacenc.html">nc</a></div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;{</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;    <span class="comment">//================================================================================</span></div>
<div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="classnc_1_1_slice.html">   43</a></span>&#160;<span class="comment"></span>    <span class="keyword">class </span><a class="code" href="classnc_1_1_slice.html">Slice</a></div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;    {</div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;    <span class="keyword">public</span>:</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;        <span class="comment">//====================================Attributes==============================</span></div>
<div class="line"><a name="l00047"></a><span class="lineno"><a class="line" href="classnc_1_1_slice.html#a36ddb261d9057db4a9794b4fc46e9d3f">   47</a></span>&#160;        <a class="code" href="namespacenc.html#a9386099a0fdc2bc9fb0dbfde5606584d">int32</a>   <a class="code" href="classnc_1_1_slice.html#a36ddb261d9057db4a9794b4fc46e9d3f">start</a>{ 0 };</div>
<div class="line"><a name="l00048"></a><span class="lineno"><a class="line" href="classnc_1_1_slice.html#ac2d72f4ca003ed645bc82efcafee87f5">   48</a></span>&#160;        <a class="code" href="namespacenc.html#a9386099a0fdc2bc9fb0dbfde5606584d">int32</a>   <a class="code" href="classnc_1_1_slice.html#ac2d72f4ca003ed645bc82efcafee87f5">stop</a>{ 1 };</div>
<div class="line"><a name="l00049"></a><span class="lineno"><a class="line" href="classnc_1_1_slice.html#a112855a11aa1737b7859e3d63feb09c4">   49</a></span>&#160;        <a class="code" href="namespacenc.html#a9386099a0fdc2bc9fb0dbfde5606584d">int32</a>   <a class="code" href="classnc_1_1_slice.html#a112855a11aa1737b7859e3d63feb09c4">step</a>{ 1 };</div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160; </div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;        <span class="comment">//============================================================================</span></div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;<span class="comment"></span>        constexpr <a class="code" href="classnc_1_1_slice.html#aeb2a7e0854fa82d97a48a5ef402d6e7c">Slice</a>() = <span class="keywordflow">default</span>;</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160; </div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;        <span class="comment">//============================================================================</span></div>
<div class="line"><a name="l00061"></a><span class="lineno"><a class="line" href="classnc_1_1_slice.html#aa54f0fae63ece8ff87455e2192d8f336">   61</a></span>&#160;<span class="comment"></span>        constexpr <span class="keyword">explicit</span> <a class="code" href="classnc_1_1_slice.html#aa54f0fae63ece8ff87455e2192d8f336">Slice</a>(<a class="code" href="namespacenc.html#a9386099a0fdc2bc9fb0dbfde5606584d">int32</a> inStop) noexcept :</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;            <a class="code" href="classnc_1_1_slice.html#ac2d72f4ca003ed645bc82efcafee87f5">stop</a>(inStop)</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;        {}</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160; </div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;        <span class="comment">//============================================================================</span></div>
<div class="line"><a name="l00071"></a><span class="lineno"><a class="line" href="classnc_1_1_slice.html#aba1f6c8193f0a61a3f5711edd58aeba1">   71</a></span>&#160;<span class="comment"></span>        constexpr <a class="code" href="classnc_1_1_slice.html#aba1f6c8193f0a61a3f5711edd58aeba1">Slice</a>(<a class="code" href="namespacenc.html#a9386099a0fdc2bc9fb0dbfde5606584d">int32</a> inStart, <a class="code" href="namespacenc.html#a9386099a0fdc2bc9fb0dbfde5606584d">int32</a> inStop) noexcept :</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;            <a class="code" href="classnc_1_1_slice.html#a36ddb261d9057db4a9794b4fc46e9d3f">start</a>(inStart),</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;            <a class="code" href="classnc_1_1_slice.html#ac2d72f4ca003ed645bc82efcafee87f5">stop</a>(inStop)</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;        {}</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160; </div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;        <span class="comment">//============================================================================</span></div>
<div class="line"><a name="l00083"></a><span class="lineno"><a class="line" href="classnc_1_1_slice.html#a91177c7ea9b87318232b8d916a487d38">   83</a></span>&#160;<span class="comment"></span>        constexpr <a class="code" href="classnc_1_1_slice.html#a91177c7ea9b87318232b8d916a487d38">Slice</a>(<a class="code" href="namespacenc.html#a9386099a0fdc2bc9fb0dbfde5606584d">int32</a> inStart, <a class="code" href="namespacenc.html#a9386099a0fdc2bc9fb0dbfde5606584d">int32</a> inStop, <a class="code" href="namespacenc.html#a9386099a0fdc2bc9fb0dbfde5606584d">int32</a> inStep) noexcept :</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;            <a class="code" href="classnc_1_1_slice.html#a36ddb261d9057db4a9794b4fc46e9d3f">start</a>(inStart),</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;            <a class="code" href="classnc_1_1_slice.html#ac2d72f4ca003ed645bc82efcafee87f5">stop</a>(inStop),</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;            <a class="code" href="classnc_1_1_slice.html#a112855a11aa1737b7859e3d63feb09c4">step</a>(inStep)</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;        {}</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160; </div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;        <span class="comment">//============================================================================</span></div>
<div class="line"><a name="l00096"></a><span class="lineno"><a class="line" href="classnc_1_1_slice.html#a769815d8fbb98ba34101c18a21efbbf5">   96</a></span>&#160;<span class="comment"></span>        <span class="keywordtype">bool</span> <a class="code" href="classnc_1_1_slice.html#a769815d8fbb98ba34101c18a21efbbf5">operator==</a>(<span class="keyword">const</span> <a class="code" href="classnc_1_1_slice.html">Slice</a>&amp; inOtherSlice) <span class="keyword">const</span> noexcept</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;        {</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;            <span class="keywordflow">return</span> <a class="code" href="classnc_1_1_slice.html#a36ddb261d9057db4a9794b4fc46e9d3f">start</a> == inOtherSlice.start &amp;&amp; <a class="code" href="classnc_1_1_slice.html#ac2d72f4ca003ed645bc82efcafee87f5">stop</a> == inOtherSlice.stop &amp;&amp; <a class="code" href="classnc_1_1_slice.html#a112855a11aa1737b7859e3d63feb09c4">step</a> == inOtherSlice.step;</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;        }</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160; </div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;        <span class="comment">//============================================================================</span></div>
<div class="line"><a name="l00108"></a><span class="lineno"><a class="line" href="classnc_1_1_slice.html#afd66bc2d5f975f986e62230b124ae607">  108</a></span>&#160;<span class="comment"></span>        <span class="keywordtype">bool</span> <a class="code" href="classnc_1_1_slice.html#afd66bc2d5f975f986e62230b124ae607">operator!=</a>(<span class="keyword">const</span> <a class="code" href="classnc_1_1_slice.html">Slice</a>&amp; inOtherSlice) <span class="keyword">const</span> noexcept</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;        {</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;            <span class="keywordflow">return</span> !(*<span class="keyword">this</span> == inOtherSlice);</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;        }</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160; </div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;        <span class="comment">//============================================================================</span></div>
<div class="line"><a name="l00118"></a><span class="lineno"><a class="line" href="classnc_1_1_slice.html#af8bc3bb19b48fd09c769fd1fa9860ed5">  118</a></span>&#160;<span class="comment"></span>        std::string <a class="code" href="classnc_1_1_slice.html#af8bc3bb19b48fd09c769fd1fa9860ed5">str</a>()<span class="keyword"> const </span></div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;<span class="keyword">        </span>{</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;            std::string out = <span class="stringliteral">&quot;[&quot;</span> + <a class="code" href="namespacenc_1_1utils.html#a16a6ad93c420ed7a003d9921bee1a7c6">utils::num2str</a>(<a class="code" href="classnc_1_1_slice.html#a36ddb261d9057db4a9794b4fc46e9d3f">start</a>) + <span class="stringliteral">&quot;:&quot;</span> + <a class="code" href="namespacenc_1_1utils.html#a16a6ad93c420ed7a003d9921bee1a7c6">utils::num2str</a>(<a class="code" href="classnc_1_1_slice.html#ac2d72f4ca003ed645bc82efcafee87f5">stop</a>) + <span class="stringliteral">&quot;:&quot;</span> + <a class="code" href="namespacenc_1_1utils.html#a16a6ad93c420ed7a003d9921bee1a7c6">utils::num2str</a>(<a class="code" href="classnc_1_1_slice.html#a112855a11aa1737b7859e3d63feb09c4">step</a>) + <span class="stringliteral">&quot;]\n&quot;</span>;</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;            <span class="keywordflow">return</span> out;</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;        }</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160; </div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;        <span class="comment">//============================================================================</span></div>
<div class="line"><a name="l00127"></a><span class="lineno"><a class="line" href="classnc_1_1_slice.html#a24c1eb77b94d3120bb02868cc965c058">  127</a></span>&#160;<span class="comment"></span>        <span class="keywordtype">void</span> <a class="code" href="classnc_1_1_slice.html#a24c1eb77b94d3120bb02868cc965c058">print</a>()<span class="keyword"> const </span></div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;<span class="keyword">        </span>{</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;            std::cout &lt;&lt; *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;        }</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160; </div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;        <span class="comment">//============================================================================</span></div>
<div class="line"><a name="l00137"></a><span class="lineno"><a class="line" href="classnc_1_1_slice.html#a4d518d51dad679d9a9c6938b065e38f8">  137</a></span>&#160;<span class="comment"></span>        <span class="keywordtype">void</span> <a class="code" href="classnc_1_1_slice.html#a4d518d51dad679d9a9c6938b065e38f8">makePositiveAndValidate</a>(<a class="code" href="namespacenc.html#af0f49663fb63332596e2e6327009d581">uint32</a> inArraySize)</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;        {</div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;            <span class="keywordflow">if</span> (<a class="code" href="classnc_1_1_slice.html#a36ddb261d9057db4a9794b4fc46e9d3f">start</a> &lt; 0)</div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;            {</div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;                <a class="code" href="classnc_1_1_slice.html#a36ddb261d9057db4a9794b4fc46e9d3f">start</a> += inArraySize;</div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;            }</div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;            <span class="keywordflow">if</span> (<a class="code" href="classnc_1_1_slice.html#a36ddb261d9057db4a9794b4fc46e9d3f">start</a> &gt; <span class="keyword">static_cast&lt;</span><a class="code" href="namespacenc.html#a9386099a0fdc2bc9fb0dbfde5606584d">int32</a><span class="keyword">&gt;</span>(inArraySize - 1))</div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;            {</div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;                <a class="code" href="_error_8hpp.html#af2aff1172060367b9c5398fa097fa8fd">THROW_INVALID_ARGUMENT_ERROR</a>(<span class="stringliteral">&quot;Invalid start value for array of size &quot;</span> + <a class="code" href="namespacenc_1_1utils.html#a16a6ad93c420ed7a003d9921bee1a7c6">utils::num2str</a>(inArraySize) + <span class="stringliteral">&quot;.&quot;</span>);</div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;            }</div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160; </div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;            <span class="keywordflow">if</span> (<a class="code" href="classnc_1_1_slice.html#ac2d72f4ca003ed645bc82efcafee87f5">stop</a> &lt; 0)</div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;            {</div>
<div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;                <a class="code" href="classnc_1_1_slice.html#ac2d72f4ca003ed645bc82efcafee87f5">stop</a> += inArraySize;</div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;            }</div>
<div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;            <span class="keywordflow">if</span> (<a class="code" href="classnc_1_1_slice.html#ac2d72f4ca003ed645bc82efcafee87f5">stop</a> &gt; <span class="keyword">static_cast&lt;</span><a class="code" href="namespacenc.html#a9386099a0fdc2bc9fb0dbfde5606584d">int32</a><span class="keyword">&gt;</span>(inArraySize))</div>
<div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;            {</div>
<div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;                <a class="code" href="_error_8hpp.html#af2aff1172060367b9c5398fa097fa8fd">THROW_INVALID_ARGUMENT_ERROR</a>(<span class="stringliteral">&quot;Invalid stop value for array of size &quot;</span> + <a class="code" href="namespacenc_1_1utils.html#a16a6ad93c420ed7a003d9921bee1a7c6">utils::num2str</a>(inArraySize) + <span class="stringliteral">&quot;.&quot;</span>);</div>
<div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;            }</div>
<div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160; </div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;            <span class="keywordflow">if</span> (<a class="code" href="classnc_1_1_slice.html#a36ddb261d9057db4a9794b4fc46e9d3f">start</a> &lt; <a class="code" href="classnc_1_1_slice.html#ac2d72f4ca003ed645bc82efcafee87f5">stop</a>)</div>
<div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;            {</div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;                <span class="keywordflow">if</span> (<a class="code" href="classnc_1_1_slice.html#a112855a11aa1737b7859e3d63feb09c4">step</a> &lt; 0)</div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;                {</div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;                    <a class="code" href="_error_8hpp.html#af2aff1172060367b9c5398fa097fa8fd">THROW_INVALID_ARGUMENT_ERROR</a>(<span class="stringliteral">&quot;Invalid slice values.&quot;</span>);</div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;                }</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;            }</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160; </div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;            <span class="keywordflow">if</span> (<a class="code" href="classnc_1_1_slice.html#ac2d72f4ca003ed645bc82efcafee87f5">stop</a> &lt; <a class="code" href="classnc_1_1_slice.html#a36ddb261d9057db4a9794b4fc46e9d3f">start</a>)</div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;            {</div>
<div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;                <span class="keywordflow">if</span> (<a class="code" href="classnc_1_1_slice.html#a112855a11aa1737b7859e3d63feb09c4">step</a> &gt; 0)</div>
<div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;                {</div>
<div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;                    <a class="code" href="_error_8hpp.html#af2aff1172060367b9c5398fa097fa8fd">THROW_INVALID_ARGUMENT_ERROR</a>(<span class="stringliteral">&quot;Invalid slice values.&quot;</span>);</div>
<div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;                }</div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160; </div>
<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;                <a class="code" href="namespacenc.html#a39da0502565b913855379ea1439047e1">std::swap</a>(<a class="code" href="classnc_1_1_slice.html#a36ddb261d9057db4a9794b4fc46e9d3f">start</a>, <a class="code" href="classnc_1_1_slice.html#ac2d72f4ca003ed645bc82efcafee87f5">stop</a>);</div>
<div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;                <a class="code" href="classnc_1_1_slice.html#a112855a11aa1737b7859e3d63feb09c4">step</a> *= -1;</div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;            }</div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;        }</div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160; </div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;        <span class="comment">//============================================================================</span></div>
<div class="line"><a name="l00188"></a><span class="lineno"><a class="line" href="classnc_1_1_slice.html#aab35be40c38521a4bd9b3c99b3d33731">  188</a></span>&#160;<span class="comment"></span>        <a class="code" href="namespacenc.html#af0f49663fb63332596e2e6327009d581">uint32</a> <a class="code" href="classnc_1_1_slice.html#aab35be40c38521a4bd9b3c99b3d33731">numElements</a>(<a class="code" href="namespacenc.html#af0f49663fb63332596e2e6327009d581">uint32</a> inArraySize) </div>
<div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;        { </div>
<div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;            <a class="code" href="classnc_1_1_slice.html#a4d518d51dad679d9a9c6938b065e38f8">makePositiveAndValidate</a>(inArraySize); </div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160; </div>
<div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;            <a class="code" href="namespacenc.html#af0f49663fb63332596e2e6327009d581">uint32</a> num = 0; </div>
<div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;            <span class="keywordflow">for</span> (<a class="code" href="namespacenc.html#a9386099a0fdc2bc9fb0dbfde5606584d">int32</a> i = <a class="code" href="classnc_1_1_slice.html#a36ddb261d9057db4a9794b4fc46e9d3f">start</a>; i &lt; <a class="code" href="classnc_1_1_slice.html#ac2d72f4ca003ed645bc82efcafee87f5">stop</a>; i += <a class="code" href="classnc_1_1_slice.html#a112855a11aa1737b7859e3d63feb09c4">step</a>) </div>
<div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;            { </div>
<div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;                ++num; </div>
<div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;            } </div>
<div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;            <span class="keywordflow">return</span> num; </div>
<div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;        } </div>
<div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160; </div>
<div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;        <span class="comment">//============================================================================</span></div>
<div class="line"><a name="l00208"></a><span class="lineno"><a class="line" href="classnc_1_1_slice.html#ad6889d2df295fef3796aebb769b8cac0">  208</a></span>&#160;<span class="comment"></span>        <span class="keyword">friend</span> std::ostream&amp; <a class="code" href="classnc_1_1_slice.html#ad6889d2df295fef3796aebb769b8cac0">operator&lt;&lt;</a>(std::ostream&amp; inOStream, <span class="keyword">const</span> <a class="code" href="classnc_1_1_slice.html">Slice</a>&amp; inSlice) </div>
<div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160;        {</div>
<div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;            inOStream &lt;&lt; inSlice.<a class="code" href="classnc_1_1_slice.html#af8bc3bb19b48fd09c769fd1fa9860ed5">str</a>();</div>
<div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;            <span class="keywordflow">return</span> inOStream;</div>
<div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;        }</div>
<div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;    };</div>
<div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;} <span class="comment">// namespace nc</span></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<div class="ttc" id="aclassnc_1_1_slice_html_ac2d72f4ca003ed645bc82efcafee87f5"><div class="ttname"><a href="classnc_1_1_slice.html#ac2d72f4ca003ed645bc82efcafee87f5">nc::Slice::stop</a></div><div class="ttdeci">int32 stop</div><div class="ttdef"><b>Definition:</b> Slice.hpp:48</div></div>
<div class="ttc" id="anamespacenc_html_a9386099a0fdc2bc9fb0dbfde5606584d"><div class="ttname"><a href="namespacenc.html#a9386099a0fdc2bc9fb0dbfde5606584d">nc::int32</a></div><div class="ttdeci">std::int32_t int32</div><div class="ttdef"><b>Definition:</b> Types.hpp:36</div></div>
<div class="ttc" id="aclassnc_1_1_slice_html_a4d518d51dad679d9a9c6938b065e38f8"><div class="ttname"><a href="classnc_1_1_slice.html#a4d518d51dad679d9a9c6938b065e38f8">nc::Slice::makePositiveAndValidate</a></div><div class="ttdeci">void makePositiveAndValidate(uint32 inArraySize)</div><div class="ttdef"><b>Definition:</b> Slice.hpp:137</div></div>
<div class="ttc" id="a_error_8hpp_html"><div class="ttname"><a href="_error_8hpp.html">Error.hpp</a></div></div>
<div class="ttc" id="aclassnc_1_1_slice_html_a24c1eb77b94d3120bb02868cc965c058"><div class="ttname"><a href="classnc_1_1_slice.html#a24c1eb77b94d3120bb02868cc965c058">nc::Slice::print</a></div><div class="ttdeci">void print() const</div><div class="ttdef"><b>Definition:</b> Slice.hpp:127</div></div>
<div class="ttc" id="aclassnc_1_1_slice_html_aa54f0fae63ece8ff87455e2192d8f336"><div class="ttname"><a href="classnc_1_1_slice.html#aa54f0fae63ece8ff87455e2192d8f336">nc::Slice::Slice</a></div><div class="ttdeci">constexpr Slice(int32 inStop) noexcept</div><div class="ttdef"><b>Definition:</b> Slice.hpp:61</div></div>
<div class="ttc" id="aclassnc_1_1_slice_html_aba1f6c8193f0a61a3f5711edd58aeba1"><div class="ttname"><a href="classnc_1_1_slice.html#aba1f6c8193f0a61a3f5711edd58aeba1">nc::Slice::Slice</a></div><div class="ttdeci">constexpr Slice(int32 inStart, int32 inStop) noexcept</div><div class="ttdef"><b>Definition:</b> Slice.hpp:71</div></div>
<div class="ttc" id="anamespacenc_1_1utils_html_a16a6ad93c420ed7a003d9921bee1a7c6"><div class="ttname"><a href="namespacenc_1_1utils.html#a16a6ad93c420ed7a003d9921bee1a7c6">nc::utils::num2str</a></div><div class="ttdeci">std::string num2str(dtype inNumber)</div><div class="ttdef"><b>Definition:</b> num2str.hpp:46</div></div>
<div class="ttc" id="anamespacenc_html_af0f49663fb63332596e2e6327009d581"><div class="ttname"><a href="namespacenc.html#af0f49663fb63332596e2e6327009d581">nc::uint32</a></div><div class="ttdeci">std::uint32_t uint32</div><div class="ttdef"><b>Definition:</b> Types.hpp:40</div></div>
<div class="ttc" id="aclassnc_1_1_slice_html_ad6889d2df295fef3796aebb769b8cac0"><div class="ttname"><a href="classnc_1_1_slice.html#ad6889d2df295fef3796aebb769b8cac0">nc::Slice::operator&lt;&lt;</a></div><div class="ttdeci">friend std::ostream &amp; operator&lt;&lt;(std::ostream &amp;inOStream, const Slice &amp;inSlice)</div><div class="ttdef"><b>Definition:</b> Slice.hpp:208</div></div>
<div class="ttc" id="anum2str_8hpp_html"><div class="ttname"><a href="num2str_8hpp.html">num2str.hpp</a></div></div>
<div class="ttc" id="aclassnc_1_1_slice_html_a36ddb261d9057db4a9794b4fc46e9d3f"><div class="ttname"><a href="classnc_1_1_slice.html#a36ddb261d9057db4a9794b4fc46e9d3f">nc::Slice::start</a></div><div class="ttdeci">int32 start</div><div class="ttdef"><b>Definition:</b> Slice.hpp:47</div></div>
<div class="ttc" id="aclassnc_1_1_slice_html_af8bc3bb19b48fd09c769fd1fa9860ed5"><div class="ttname"><a href="classnc_1_1_slice.html#af8bc3bb19b48fd09c769fd1fa9860ed5">nc::Slice::str</a></div><div class="ttdeci">std::string str() const</div><div class="ttdef"><b>Definition:</b> Slice.hpp:118</div></div>
<div class="ttc" id="aclassnc_1_1_slice_html_aab35be40c38521a4bd9b3c99b3d33731"><div class="ttname"><a href="classnc_1_1_slice.html#aab35be40c38521a4bd9b3c99b3d33731">nc::Slice::numElements</a></div><div class="ttdeci">uint32 numElements(uint32 inArraySize)</div><div class="ttdef"><b>Definition:</b> Slice.hpp:188</div></div>
<div class="ttc" id="aclassnc_1_1_slice_html_a769815d8fbb98ba34101c18a21efbbf5"><div class="ttname"><a href="classnc_1_1_slice.html#a769815d8fbb98ba34101c18a21efbbf5">nc::Slice::operator==</a></div><div class="ttdeci">bool operator==(const Slice &amp;inOtherSlice) const noexcept</div><div class="ttdef"><b>Definition:</b> Slice.hpp:96</div></div>
<div class="ttc" id="aclassnc_1_1_slice_html_a112855a11aa1737b7859e3d63feb09c4"><div class="ttname"><a href="classnc_1_1_slice.html#a112855a11aa1737b7859e3d63feb09c4">nc::Slice::step</a></div><div class="ttdeci">int32 step</div><div class="ttdef"><b>Definition:</b> Slice.hpp:49</div></div>
<div class="ttc" id="anamespacenc_html"><div class="ttname"><a href="namespacenc.html">nc</a></div><div class="ttdef"><b>Definition:</b> Coordinate.hpp:44</div></div>
<div class="ttc" id="anamespacenc_html_a39da0502565b913855379ea1439047e1"><div class="ttname"><a href="namespacenc.html#a39da0502565b913855379ea1439047e1">nc::swap</a></div><div class="ttdeci">void swap(NdArray&lt; dtype &gt; &amp;inArray1, NdArray&lt; dtype &gt; &amp;inArray2) noexcept</div><div class="ttdef"><b>Definition:</b> swap.hpp:42</div></div>
<div class="ttc" id="a_error_8hpp_html_af2aff1172060367b9c5398fa097fa8fd"><div class="ttname"><a href="_error_8hpp.html#af2aff1172060367b9c5398fa097fa8fd">THROW_INVALID_ARGUMENT_ERROR</a></div><div class="ttdeci">#define THROW_INVALID_ARGUMENT_ERROR(msg)</div><div class="ttdef"><b>Definition:</b> Error.hpp:36</div></div>
<div class="ttc" id="aclassnc_1_1_slice_html_afd66bc2d5f975f986e62230b124ae607"><div class="ttname"><a href="classnc_1_1_slice.html#afd66bc2d5f975f986e62230b124ae607">nc::Slice::operator!=</a></div><div class="ttdeci">bool operator!=(const Slice &amp;inOtherSlice) const noexcept</div><div class="ttdef"><b>Definition:</b> Slice.hpp:108</div></div>
<div class="ttc" id="aclassnc_1_1_slice_html_a91177c7ea9b87318232b8d916a487d38"><div class="ttname"><a href="classnc_1_1_slice.html#a91177c7ea9b87318232b8d916a487d38">nc::Slice::Slice</a></div><div class="ttdeci">constexpr Slice(int32 inStart, int32 inStop, int32 inStep) noexcept</div><div class="ttdef"><b>Definition:</b> Slice.hpp:83</div></div>
<div class="ttc" id="a_types_8hpp_html"><div class="ttname"><a href="_types_8hpp.html">Types.hpp</a></div></div>
<div class="ttc" id="aclassnc_1_1_slice_html_aeb2a7e0854fa82d97a48a5ef402d6e7c"><div class="ttname"><a href="classnc_1_1_slice.html#aeb2a7e0854fa82d97a48a5ef402d6e7c">nc::Slice::Slice</a></div><div class="ttdeci">constexpr Slice()=default</div></div>
<div class="ttc" id="aclassnc_1_1_slice_html"><div class="ttname"><a href="classnc_1_1_slice.html">nc::Slice</a></div><div class="ttdoc">A Class for slicing into NdArrays.</div><div class="ttdef"><b>Definition:</b> Slice.hpp:43</div></div>
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_34171bd951b13a53aa9f237277a18e40.html">NumCpp</a></li><li class="navelem"><a class="el" href="dir_a0b3eef1c4a290b815c33ad6e7027cf3.html">Core</a></li><li class="navelem"><a class="el" href="_slice_8hpp.html">Slice.hpp</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.17 </li>
  </ul>
</div>
</body>
</html>
